package cn.mdmm.user.service.impl.system;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;

import cn.mdmm.user.common.DictCache;
import cn.mdmm.user.entity.system.SysDetail;
import cn.mdmm.user.mapper.system.SysDetailMapper;
import cn.mdmm.user.service.system.SysDetailService;
import cn.modoumama.service.base.impl.BaseServiceImpl;

@Service(version = "1.0")
public class SysDetailServiceImpl extends BaseServiceImpl<SysDetail, Long> implements SysDetailService {
	@Autowired
	DictCache dictCache;
	@Autowired
	public void setMapper(SysDetailMapper mapper) {
		super.setGenericMapper(mapper);
	}
	
	@Override
	public void init() {
		super.init();
		dictCache.reCacheDict();
	}

	@Override
	public Integer insert(SysDetail record) {
		int count = 0;
		record.setCreateTime(new Date());
		record.setUpdateTime(new Date());
		record.setDetailStatus(1);
		count = super.insert(record);
		return count;
	}
	
	@Override
	public Integer mergeById(SysDetail entity) {
		entity.setUpdateTime(new Date());
		return super.mergeById(entity);
	}

	@Override
	public Integer updateById(SysDetail entity) {
		entity.setUpdateTime(new Date());
		return super.updateById(entity);
	}

	@Override
	public Integer updateNULLById(SysDetail entity) {
		entity.setUpdateTime(new Date());
		return super.updateNULLById(entity);
	}

	@Override
	public Integer removeById(Long detailId) {
		int flag = super.removeById(detailId);
		return flag;
	}
}
